<!-- Code Mirror CSS file. -->
<link rel="stylesheet" href="//cdn.staticfile.org/codemirror/5.48.4/codemirror.min.css">
<script src="__STATIC__/plugins/froala_editor/froala_editor.min.js"></script>
<script src="__STATIC__/plugins/froala_editor/plugins/image.min.js"></script>
<script src="__STATIC__/plugins/froala_editor/plugins/file.min.js"></script>
<script src="__STATIC__/plugins/froala_editor/plugins/video.min.js"></script>
<?php
	$___pluginArr=[
		'Align'=>['/js/plugins/align.min.js'],
		'CharCounter'=>['/js/plugins/char_counter.min.js','/css/plugins/char_counter.min.css'],
		'CodeBeautifier'=>['/js/plugins/code_beautifier.min.js'],
		'CodeView'=>['/js/plugins/code_view.min.js','/css/plugins/code_view.min.css'],
		'Colors'=>['/js/plugins/colors.min.js','/css/plugins/colors.min.css'],
		'Draggable'=>['/js/plugins/draggable.min.js','/css/plugins/draggable.min.css'],
		'Embedly'=>['/js/third_party/embedly.min.js','/css/third_party/embedly.min.css'],
		'Emoticons'=>['/js/plugins/emoticons.min.js','/css/plugins/emoticons.min.css'],
		'Entities'=>['/js/plugins/entities.min.js'],
		//'File'=>['/js/plugins/file.min.js','/css/plugins/file.min.css'],
		'File'=>['','/css/plugins/file.min.css'],
		'FontFamily'=>['/js/plugins/font_family.min.js'],
		'FontSize'=>['/js/plugins/font_size.min.js'],
		'Fullscreen'=>['/js/plugins/fullscreen.min.js','/css/plugins/fullscreen.min.css'],
		'Help'=>['/js/plugins/help.min.js','/css/plugins/help.min.css'],
		//'Image'=>['/js/plugins/image.min.js','/css/plugins/image.min.css'],
		'Image'=>['','/css/plugins/image.min.css'],
		'ImageManager'=>['/js/plugins/image_manager.min.js','/css/plugins/image_manager.min.css'],
		'ImageTui'=>['/js/third_party/image_tui.min.js','/css/third_party/image_tui.min.css'],
		'InlineClass'=>['/js/plugins/inline_class.min.js'],
		'InlineStyle'=>['/js/plugins/inline_style.min.js'],
		'LineBreaker'=>['/js/plugins/line_breaker.min.js','/css/plugins/line_breaker.min.css'],
		'LineHeight'=>['/js/plugins/line_height.min.js'],
		'Link'=>['/js/plugins/link.min.js'],
		'Lists'=>['/js/plugins/lists.min.js'],
		'ParagraphFormat'=>['/js/plugins/paragraph_format.min.js'],
		'ParagraphStyle'=>['/js/plugins/paragraph_style.min.js'],
		'Print'=>['/js/plugins/print.min.js'],
		'QuickInsert'=>['/js/plugins/quick_insert.min.js','/css/plugins/quick_insert.min.css'],
		'Quote'=>['/js/plugins/quote.min.js'],
		'Save'=>['/js/plugins/save.min.js'],
		'SpecialCharacters'=>['/js/plugins/special_characters.min.js','/css/plugins/special_characters.min.css'],
		'SpellChecker'=>['/js/third_party/spell_checker.min.js','/css/third_party/spell_checker.min.css'],
		'Table'=>['/js/plugins/table.min.js','/css/plugins/table.min.css'],
		'Url'=>['/js/plugins/url.min.js'],
		//'Video'=>['/js/plugins/video.min.js','/css/plugins/video.min.css'],
		'Video'=>['','/css/plugins/video.min.css'],
		'WordPaste'=>['/js/plugins/word_paste.min.js'],
	];
	$___plugins=['Align','CharCounter','CodeBeautifier','CodeView','Colors','Draggable','Embedly','Emoticons','Entities','File','FontFamily','FontSize','Fullscreen','Help','Image','ImageManager','ImageTui','InlineClass','InlineStyle','LineBreaker','LineHeight','Link','Lists','ParagraphFormat','ParagraphStyle','Print','Quote','Save','SpecialCharacters','SpellChecker','Table','Url','Video','WordPaste'];
	$___CSS=[
		'npm/codemirror@5.49.2/theme/monokai.css',
		'npm/froala-editor@3.0.6/css/froala_editor.pkgd.min.css',
		'npm/froala-editor@3.0.6/css/froala_style.min.css'
	];
	$___JSS=[
		'npm/codemirror@5.49.2',
		'npm/codemirror@5.49.2/mode/htmlmixed/htmlmixed.min.js',
		/*'npm/froala-editor@3.0.6/js/froala_editor.pkgd.min.js',*/
		'npm/froala-editor@3.0.6/js/languages/zh_cn.js'
	];
	foreach($___plugins as $pk=>$pv){
		if($___pluginArr[$pv][0]){
			$___JSS[]='npm/froala-editor@3.0.6'.$___pluginArr[$pv][0];
		}
		if($___pluginArr[$pv][1]){
			$___CSS[]='npm/froala-editor@3.0.6'.$___pluginArr[$pv][1];
		}
	}
	echo '<script src="//cdn.jsdelivr.net/combine/'.implode($___JSS,',').'"></script>';
	echo '<link href="//cdn.jsdelivr.net/combine/'.implode($___CSS,',').'" rel="stylesheet" />';
?>
<script>
layui.use(['jquery'], function(e) {
	window.jQuery = window.$ = $ = jQuery= layui.jquery;
	window.editor = new FroalaEditor('#[id]',{
		language: 'zh_cn',
		codeMirrorOptions: {
			theme:'monokai',
			indentWithTabs: true,
			lineNumbers: true,
			lineWrapping: true,
			mode: 'text/html',
			tabMode: 'indent',
			tabSize: 2
		},
		autosave: true,
		autosaveInterval: 180,
		saveURL: '/Article/autosave.html',
		saveParams: {
			title:function (){return $('[name=title]').val();},
			tags:function (){return $('#tags_ipt').val();},
			cid:function (){return $('[name=cid]').val();}
		},
		saveParam:'content',
		imageManagerLoadURL: "/Attach/getList.html?type=image&p=",
		imageManagerDeleteURL: "/Attach/delete.html",
		imageUploadToQiniu: {
			getTokenUrl: "/Attach/getToken",
			domain: "http://static.sssui.com/"
		},
		fileUploadToQiniu: {
			getTokenUrl: "/Attach/getToken",
			domain: "http://static.sssui.com/",
		},
		videoUploadToQiniu: {
			getTokenUrl: "/Attach/getToken",
			domain: "http://static.sssui.com/"
		},
		events: {
			'image.uploaded': function (response) {
				///Attach/save.html?key=
				console.log('uploaded',this,response);
			},
			'image.uploadedToQiniu': function (data) {
				///Attach/save.html?key=
				console.log('uploadedToQiniu',this,data);
			}
		}
	});
})
</script>